/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("production_workorder",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using MES.Production.IServices;

namespace MES.Production.Controllers
{
    public partial class production_workorderController
    {
        private readonly Iproduction_workorderService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public production_workorderController(
            Iproduction_workorderService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        [Route("changeStatus"), HttpPost]
        public IActionResult ChangeStatus([FromBody] List<production_workorder> list, string? status)
        {
            var result = Service.ChangeStatus(list, status);
            return JsonNormal(new { message = result, status = true });
        }
        [Route("getSelectorWorkOrder"), HttpPost]
        public IActionResult getSelectorWorkOrder([FromBody] PageDataOptions loadData)
        {
            //1、调用框架的查询方法
            var gridData = _service.GetPageData(loadData);
            return JsonNormal(gridData);
        }
    }
}
